<?php
include 'includes.php';
?>

<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta name="description" content="">
        <meta name="author" content="">
        <link rel="shortcut icon" href="../../assets/ico/favicon.ico">
        <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
        <link href="bootstrap/css/bootstrap.css" rel="stylesheet">
        <link href="bootstrap/css/css.css" rel="stylesheet">
        <script type="text/javascript" src="bootstrap/js/jquery-1.11.0.min.js"></script>

        <title>The Pengüins mafia Bis List - Editar PJ</title>

    </head>


    <?php
    include './cabecera.php';
    ?>



    <script type="text/javascript" src="http://static.wowhead.com/widgets/power.js"></script><script>var wowhead_tooltips = {"colorlinks": true, "iconizelinks": true, "renamelinks": true}</script>

    <div class="container contenido">
        <div class="page-header">
            <h2>Bis List <small>Selecciona items Bis</small></h1>
        </div>
    </div>
    <?php
    if (isset($_SESSION['user'])) {

        $pj = R::getAll('select * from pjs where usuario_id = :id', [':id' => $_SESSION['user']['id']]);

        $pj1 = $pj[0];

        $items = R::getAll('select * from items where bosses_id = :boss order by tipo', [':boss' => $_GET['id']]);
        ?>
        <div class="container">
            <!-- Example row of columns -->
            <div class="row">
                <div class="col-md-10">
                    <form role="form" method="POST" action="bisListEditada.php?boss=<?php echo $_GET['id'] ?> ">
                        <div class="row">
                            <div class="col-md-6">
                                <h3>Heroico</h3>
                            </div>
                            <div class="col-md-6">
                                <h3>Heroico Warforged</h3>
                            </div>
                        </div>
                        
                        <?php
                        $tipo = "";
                        for ($i = 0; $i < count($items); $i++) {
                            if ($tipo != $items[$i]['tipo']) {
                                echo '<div class="row"><div class="col-md-6"><h4>'
                                . $items[$i]['tipo']
                                . '</h4></div></div>';
                                
                                $tipo = $items[$i]['tipo'];
                            }

                            $Heroico = R::findOne('bislist', 'pj = :pj and item = :item and dificultad = "H"', [':pj' => $pj1['id'], ':item' => $items[$i]['id']]);
                            if (isset($Heroico)) {
                                $checkedH = 'checked';
                                if ($Heroico->bis == 1) {
                                    $Hbis = 'checked';
                                } else {
                                    $Hbis = '';
                                }
                            } else {
                                $Hbis = '';
                                $checkedH = '';
                            }
                            $HeroicoW = R::findOne('bislist', 'pj = :pj and item = :item and dificultad = "HW"', [':pj' => $pj1['id'], ':item' => $items[$i]['id']]);
                            if (isset($HeroicoW)) {
                                $checkedHW = 'checked';
                                if ($HeroicoW->bis == 1) {
                                    $HWbis = 'checked';
                                } else {
                                    $HWbis = '';
                                }
                            } else {
                                $checkedHW = '';
                                $HWbis = '';
                            }
                            echo '<div class="row">
                        <div class="col-md-6">
                                 
               
                                <label class="checkbox-inline">
                                    <input type="checkbox" ' . $checkedH . ' name="' . $items[$i]['id'] . 'H">
                                    <a href="#" rel="item-' . $items[$i]['linkh'] . '&domain=es">' . $items[$i]['linkh'] . '</a>                                    
                                </label>
                                
                                <label class="checkbox-inline">
                                <input type="checkbox" ' . $Hbis . ' name="' . $items[$i]['id'] . 'HB">
                                Bis    
                                </label>
                        </div>

                        <div class="col-md-6">
                                <label class="checkbox-inline">
                                    <input type="checkbox" ' . $checkedHW . ' name="' . $items[$i]['id'] . 'HW">
                                    <a href="#" rel="item-' . $items[$i]['linkhw'] . '&domain=es">' . $items[$i]['linkhw'] . '</a>   
                                </label>
                                <label class="checkbox-inline">
                                <input type="checkbox" ' . $HWbis . ' name="' . $items[$i]['id'] . 'HWB">
                                Bis    
                                </label>
                        </div>
                    </div>';
                        }
                        ?>             
                        <hr>
                        <button type="submit" class="btn btn-success">Enviar</button>
                    </form>
                </div>
            </div>
            <hr>

        </div> <!-- /container -->

        <?php
    }
    ?>
    <!-- Bootstrap core JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->


    <?php
    include 'pie.php';
    ?>